package util;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class UrlUtility {
	public static void forwardPage(HttpServletRequest req, HttpServletResponse res, String address) {
		RequestDispatcher rd = req.getRequestDispatcher(address);
		try {
			rd.forward(req, res);
		} catch (ServletException | IOException e) {
			e.printStackTrace();
		}
	}
	
	public static void redirectPage(HttpServletResponse res, String address) {
		try {
			res.sendRedirect(address);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
